
char arr[101];
#define KEY '#'  
char flag[4] = { '|' ,'/','-','\\' };

void processbar(double rate, double total, int counter)
{
    memset(arr, '\0', sizeof(arr));
    counter++;
    double process = counter * rate;
    int Precent = (int)(process / total) * 100;
    for (int i = 0; i < Precent; i++)
    {
        arr[i] = KEY;
    }
    int counter1 = 0;
    while (1)
    {

        printf("[%-100s] %d%% [%c]\r  ", arr, Precent, flag[counter1 % 4]);
        counter1++;
    }



}
